Page({
  data: {
    userInfo: {}
  },
  goLogin() {
    wx.navigateTo({
      url: '/pages/login/index',
    })
  },
  onShow() {
    this.getUserInfo()
  },
  async getUserInfo() {
    try {
      const {
        code,
        data
      } = await wx.http.get('/userInfo')
      if (code !== 10000) return wx.utils.toast()
      this.setData({
        userInfo: data
      })
      wx.setStorageSync('userInfo', data)
    } catch (e) {
      // console.log(e)
    }
  }
})